package cn.iocoder.yudao.module.project.dal.mysql.internalcode;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.project.dal.dataobject.internalcode.InternalCodeDO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.project.controller.admin.internalcode.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 内码信息 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface InternalCodeMapper extends BaseMapperX<InternalCodeDO> {

    default PageResult<InternalCodeDO> selectPage(InternalCodePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InternalCodeDO>()
                .likeIfPresent(InternalCodeDO::getId, reqVO.getId())
                .likeIfPresent(InternalCodeDO::getName, reqVO.getName())
                .likeIfPresent(InternalCodeDO::getOrderCode, reqVO.getOrderCode())
                .likeIfPresent(InternalCodeDO::getMaterialCode, reqVO.getMaterialCode())
                .likeIfPresent(InternalCodeDO::getBatchNumber, reqVO.getBatchNumber())
                .eqIfPresent(InternalCodeDO::getBatchCheckNumber, reqVO.getBatchCheckNumber())
                .betweenIfPresent(InternalCodeDO::getOperatingTime, reqVO.getOperatingTime())
                .eqIfPresent(InternalCodeDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(InternalCodeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(InternalCodeDO::getId));
    }

    List<InternalCodeDO> selectSavedList(Map<String, Object> params);

    void insertList(List<InternalCodeDO> insertList);

    void updateList(List<InternalCodeDO> updateList);

    void clearWeightHistory(Map<String, Object> params);

    List<InternalCodeWorkstationRespVO> listWorkstationDetail(Page<InternalCodeWorkstationRespVO> pageParam, @Param("reqVO") InternalCodePageReqVO reqVO, @Param("roleVO")InternalCodeRoleVO internalCodeRoleVO);

    List<InternalCodeDO> selectInternalCodeByPage(Page<InternalCodePageReqVO> pageParam, @Param("reqVO")InternalCodePageReqVO reqVO);

    List<InternalCodeWorkstationRespVO> listUnfinishReport(Page<InternalCodeWorkstationRespVO> pageParam, @Param("reqVO") InternalCodePageReqVO reqVO, @Param("roleVO")InternalCodeRoleVO internalCodeRoleVO);

    List<InternalCodeWorkstationRespVO> listCurrentWorkstationDetail(Page<InternalCodeWorkstationRespVO> pageParam, @Param("reqVO") InternalCodePageReqVO reqVO, @Param("roleVO")InternalCodeRoleVO internalCodeRoleVO);

    Long getUnfinishCount(@Param("reqVO") InternalCodePageReqVO reqVO, @Param("roleVO")InternalCodeRoleVO internalCodeRoleVO);
}